/**
 * Copyright (c) 2025 ~ 2026 KylinSec Co., Ltd.
 * kiran-authentication-devices is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 * http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 *
 * Author: yangfeng <yangfeng@kylinsec.com.cn>
 */
#pragma once

#include <QScopedPointer>

#include "driver/driver.h"

namespace Kiran
{
typedef void *HANDLE;
struct FPAratekDriverLib;

class FPAratekDriver : public Driver
{
    Q_OBJECT
public:
    FPAratekDriver(QObject *parent = nullptr);
    ~FPAratekDriver();

    bool initDriver(const QString &libPath = QString()) override;
    bool loadLibrary(const QString &libPath) override;
    bool isLoaded() override;

    int openDevice();
    int closeDevice();
    bool isDeviceOpened();

    // 获取指纹特征
    int acquireFeature(unsigned char *fea);
    // 对比两枚指纹特征是否匹配
    int templateMatch(QByteArray fpTemplate1, QByteArray fpTemplate2);

private:
    QScopedPointer<FPAratekDriverLib>
        m_driverLib;
    HANDLE m_libHandle;
    HANDLE m_deviceHandle;

    int m_width;
    int m_height;
    int m_dpi;
};

}  // namespace Kiran